package com.ruoyi.common.constant;

/**
 * 常用数值常量类
 * 包含常用整数和小数常量定义
 */
public final class NumberConstants {

    // 防止类被实例化
    private NumberConstants() {}

    /**************************
     *  常用整数常量
     **************************/

    /** 数字0 */
    public static final int ZERO = 0;
    /** 数字1 */
    public static final int ONE = 1;
    /** 数字2 */
    public static final int TWO = 2;
    /** 数字3 */
    public static final int THREE = 3;
    /** 数字4 */
    public static final int FOUR = 4;
    /** 数字5 */
    public static final int FIVE = 5;
    /** 数字6 */
    public static final int SIX = 6;
    /** 数字7 */
    public static final int SEVEN = 7;
    /** 数字8 */
    public static final int EIGHT = 8;
    /** 数字9 */
    public static final int NINE = 9;
    /** 数字10 */
    public static final int TEN = 10;
    /** 数字15 */
    public static final int FIFTEEN = 15;
    /** 数字16 */
    public static final int SIXTEEN = 16;
    /** 数字100 */
    public static final int ONE_HUNDRED = 100;
    /** 数字180 */
    public static final int ONE_HUNDRED_EIGHTY = 180;
    /** 数字249 */
    public static final int TWO_HUNDRED_FORTY_NINE = 249;
    /** 数字1000 */
    public static final int ONE_THOUSAND = 1000;
    /** 数字10000 */
    public static final int TEN_THOUSAND = 10000;
    /** 数字32768 */
    public static final int THIRTY_TWO_THOUSAND_SEVEN_HUNDRED_SIXTY_EIGHT = 32768;
    /** 数字65536 */
    public static final int SIXTY_FIVE_THOUSAND_FIVE_HUNDRED_THIRTY_SIX = 65536;
    /** 数字180000 */
    public static final int ONE_HUNDRED_EIGHTY_THOUSAND = 180000;

    /**************************
     *  常用小数字常量 (double)
     **************************/

    /** 小数0.1 */
    public static final double DECIMAL_POINT_ONE = 0.1;
    /** 小数0.01 */
    public static final double DECIMAL_POINT_ZERO_ONE = 0.01;
    /** 小数0.001 */
    public static final double DECIMAL_POINT_ZERO_ZERO_ONE = 0.001;

    /**************************
     *  常用数值工具方法
     **************************/

    /**
     * 获取数字对应的中文大写表示（支持0-10）
     * @param number 数字
     * @return 中文大写字符串，不存在时返回null
     */
    public static String getChineseNumber(int number) {
        switch (number) {
            case ZERO: return "零";
            case ONE: return "一";
            case TWO: return "二";
            case THREE: return "三";
            case FOUR: return "四";
            case FIVE: return "五";
            case SIX: return "六";
            case SEVEN: return "七";
            case EIGHT: return "八";
            case NINE: return "九";
            case TEN: return "十";
            default: return null;
        }
    }

    /**
     * 判断是否为0-10之间的整数
     * @param number 待检查的数字
     * @return true如果是0-10之间的整数，否则false
     */
    public static boolean isInRange0To10(int number) {
        return number >= ZERO && number <= TEN;
    }

    /**
     * 判断是否为1-10之间的整数
     * @param number 待检查的数字
     * @return true如果是1-10之间的整数，否则false
     */
    public static boolean isInRange1To10(int number) {
        return number >= ONE && number <= TEN;
    }

    /**
     * 判断是否为常用小数常量
     * @param number 待检查的数字
     * @return true如果是定义的小数常量之一，否则false
     */
    public static boolean isCommonDecimal(double number) {
        return number == DECIMAL_POINT_ONE ||
                number == DECIMAL_POINT_ZERO_ONE ||
                number == DECIMAL_POINT_ZERO_ZERO_ONE;
    }
}
